


import junit.framework.TestCase;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import edu.towson.cosc603.coffeemaker.Recipe;

public class ReceipeTest extends TestCase  {
	Recipe recipe;
	
	
	@Before
	public void setUp() throws Exception {
		recipe = new Recipe();
	}

	@After
	public void tearDown() throws Exception {
	}
	@Test
	public void testGetters(){
		recipe.setAmtChocolate(2);
		assertEquals(2, recipe.getAmtChocolate());
		recipe.setAmtCoffee(2);
		assertEquals(2,recipe.getAmtCoffee());
		recipe.setAmtMilk(2);
		assertEquals(2, recipe.getAmtMilk());
		recipe.setPrice(2);
		assertEquals(2, recipe.getPrice());
		recipe.setAmtSugar(2);
		assertEquals(2, recipe.getAmtSugar());
		recipe.setName("cookie");
		assertTrue("cookie".equals(recipe.getName()));
	}
	@Test
	public void testSetAmtChocolate() {
		//-ve amount test.
		recipe.setAmtChocolate(-2);
		assertEquals(0,recipe.getAmtChocolate());
		//good data test
		recipe.setAmtChocolate(0);
		assertEquals(0,recipe.getAmtChocolate());
	}

	@Test
	public void testSetAmtCoffee() {
		//-ve amount test.
		recipe.setAmtCoffee(-2);
		assertEquals(0,recipe.getAmtCoffee());
		//good data test
		recipe.setAmtCoffee(0);
		assertEquals(0,recipe.getAmtCoffee());
		recipe.setAmtCoffee(2);
		assertEquals(2,recipe.getAmtCoffee());
		
		
		
	}

	@Test
	public void testSetAmtMilk() {
		//-ve amount test.
		recipe.setAmtMilk(-2);
		assertEquals(0,recipe.getAmtMilk());
		//good data test
		recipe.setAmtMilk(0);
		assertEquals(0,recipe.getAmtMilk());

		recipe.setAmtMilk(2);
		assertEquals(2,recipe.getAmtMilk());
	}

	@Test
	public void testSetAmtSugar() {
		//-ve amount test.
		recipe.setAmtSugar(-2);
		assertEquals(0,recipe.getAmtSugar());
		//good data test
		recipe.setAmtSugar(0);
		assertEquals(0,recipe.getAmtSugar());
		

		recipe.setAmtSugar(2);
		assertEquals(2,recipe.getAmtSugar());
	}

	@Test
	public void testSetName() {
		//good data test
		recipe.setName("ITEM");
		assertEquals("ITEM",recipe.getName());
	}

	@Test
	public void testSetPrice() {
		//-ve amount test.
		recipe.setPrice(-2);
		assertEquals(0,recipe.getPrice());
		//good data test
		recipe.setPrice(0);
		assertEquals(0,recipe.getPrice());
		

		recipe.setPrice(2);
		assertEquals(2,recipe.getPrice());
	}

	@Test
	public void testEqualsRecipe() {
		recipe.setName("ITEM");
		Recipe copy = recipe;
		assertTrue(recipe.equals(copy));
		Recipe sameName = new Recipe();
		sameName.setName(recipe.getName());
		assertTrue(recipe.equals(sameName));
		
		Recipe nullName = new Recipe();
		assertFalse(recipe.equals(nullName));
		assertFalse(nullName.equals(recipe));
		
	}
	
	@Test
	public void testToString(){
		recipe.setName("ITEM");
		assertEquals("ITEM", recipe.toString());
		Recipe nullName = new Recipe();
		assertNull(nullName.toString());
	}

}
